<?php
/**
 * Person's Model
 *
 * @category    IPB_CMS
 * @package     Application_Model
 * @copyright   Copyright (c) 2009 IPB CMS <http://ipb-cms.googlecode.com/>
 * @license     http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License
 * @author      Henrique Moody <henriquemoody@gmail.com>
 */
class Model_Person extends App_Model_Abstract
{

    /**
     * Person's type member
     */
    const TYPE_MEMBER = 'member';

    /**
     * Person's type congregated
     */
    const TYPE_CONGREGATED = 'congregated';

    /**
     * Person's status communion
     */
    const STATUS_COMMUNION = 'communion';

    /**
     * Person's status disciplined
     */
    const STATUS_DISCIPLINED = 'disciplined';

    /**
     * Person's status excluded
     */
    const STATUS_EXCLUDED = 'excluded';

    /**
     * ID of the person
     *
     * @var integer
     */
    protected $_personId;

    /**
     * Created at
     *
     * @var Zend_Date
     */
    protected $_personCreated;

    /**
     * Updated at
     *
     * @var Zend_Date|null
     */
    protected $_personUpdated;

    /**
     * Person's first name
     *
     * @var string
     */
    protected $_personFirstName;

    /**
     * Person's last name
     *
     * @var string
     */
    protected $_personLastName;

    /**
     * Person's type
     *
     * Must be member (Model_Person::TYPE_MEMBER)
     * or congregated (Model_Person::TYPE_CONGREGATED)
     *
     * @var string
     */
    protected $_personType;

    /**
     * Person's status
     *
     * Must be "communion" (Model_Person::STATUS_COMMUNION),
     * "disciplined" (Model_Person::STATUS_DISCIPLINED) or
     * "excluded" (Model_Person::STATUS_EXCLUDED)
     *
     * @var string
     */
    protected $_personStatus;

    /**
     * Sets the ID of the person
     *
     * @param integer|null $id ID of the person
     * @return Model_Person Fluent interface, returns self
     */
    public function setId($id)
    {
        if(!is_null($id)) {
            $this->_personId = (integer) $id;
        }
        return $this;
    }

    /**
     * Returns the ID of the person
     *
     * @return integer|null ID of the person
     */
    public function getId()
    {
        return $this->_personId;
    }

    /**
     * Date and time of creation
     *
     * @see Zend_Date
     * @param integer|string $datetime Date of creation
     * @return Model_User Fluent interface, returns self
     */
    public function setCreated($datetime) {
        $this->_personCreated = new Zend_Date($datetime);
        return $this;
    }

    /**
     * Returns the date of the creation
     *
     * @return Zend_Date
     */
    public function getCreated()
    {
        return $this->_personCreated;
    }

    /**
     * Date and time of the last update (if any)
     *
     * @see Zend_Date
     * @param integer|string|null $datetime Date of the update
     * @return Model_User Fluent interface, returns self
     */
    public function setUpdated($datetime = null) {
        if (!is_null($datetime)) {
            $this->_personUpdated = new Zend_Date($datetime);
        }
        return $this;
    }

    /**
     * Returns date and time of the last update (if any)
     *
     * @return Zend_Data|null
     */
    public function getUpdated()
    {
        return $this->_personUpdated;
    }

    /**
     * Sets the person's first name
     *
     * @param string $firstName Person's first name
     * @return Model_Person Fluent interface, returns self
     */
    public function setFirstName($firstName)
    {
        $this->_personFirstName = (string) $firstName;
        return $this;
    }

    /**
     * Returns the person's first name
     *
     * @return string|null Person's first name
     */
    public function getFirstName()
    {
        return $this->_personFirstName;
    }

    /**
     * Sets the person's last name
     *
     * @param string $lastName Person's last name
     * @return Model_Person Fluent interface, returns self
     */
    public function setLastName($lastName)
    {
        $this->_personLastName = (string) $lastName;
        return $this;
    }

    /**
     * Returns the person's last name
     *
     * @return string|null Person's last name
     */
    public function getLastName()
    {
        return $this->_personLastName;
    }

    /**
     * Sets the person's type
     *
     * @param string $type Person's type
     * @return Model_Person Fluent interface, returns self
     */
    public function setType($type)
    {
        $this->_personType = (string) $type;
        return $this;
    }

    /**
     * Returns the person's type
     *
     * @return string|null Person's type
     */
    public function getType()
    {
        return $this->_personType;
    }

    /**
     * Sets the person's status
     *
     * @param string $status Person's status
     * @return Model_Person Fluent interface, returns self
     */
    public function setStatus($status)
    {
        $this->_personStatus = (string) $status;
        return $this;
    }

    /**
     * Returns the person's status
     *
     * @return string|null Person's status
     */
    public function getStatus()
    {
        return $this->_personStatus;
    }

}
